import {connect} from 'react-redux';
import {Link} from 'react-router';
import action from '../action';

class About extends React.Component {
    componentDidMount(){
        this.props.init();
    }

    render(){
        return (
            <div>
                <h1>这是{this.props.aboutData.title}</h1>
                <p>{this.props.aboutData.desc}</p>
                <Link to="/" className="testClass">>> 首页</Link>
            </div>
        )
    }
}

//主要给server端引用
About.initAction=action.loadAboutData;

About = connect(state => {
    const {aboutData}=state;
    return {aboutData};
}, dispatch => ({
    init(){
        dispatch(About.initAction());
    }
}))(About);

export default About